
import { Request } from '../utils/request';

/**
 * 新建相册
 * @param name 相册名
 * @param description
 * @param isDefaultAlbum
 * @returns
 */
export function createAlbum(name: string, description: string, isDefaultAlbum: number) {
  return Request.axiosInstance({
    url: '/album/create',
    method: 'post',
    data: { name, description, isDefaultAlbum }
  })
}

/**
 * 编辑相册信息
 * @param albumId 相册ID
 * @param name 相册名
 * @param description 相册描述
 * @returns
 */
export function editAlbum(albumId: number, name: string, description: string) {
  return Request.axiosInstance({
    url: '/album/edit',
    method: 'put',
    data: { albumId, name, description }
  })
}

/**
 * 合并相册，将相册A合并到相册B
 * @param originAlbumId 原相册A
 * @param targetAlbumId 目标相册B
 * @returns
 */
export function unitAlbum(originAlbumId: number, targetAlbumId: number) {
  return Request.axiosInstance({
    url: '/album/unit',
    method: 'post',
    data: { originAlbumId, targetAlbumId }
  })
}

/**
 * 删除相册，相册中照片移动至回收站
 * @param albumId 相册ID
 * @returns
 */
export function delAlbum(albumId: number) {
  return Request.axiosInstance({
    url: '/album/del',
    method: 'delete',
    params: { albumId }
  })
}

/**
 * 获取相册信息
 * @param albumId 相册ID
 * @returns
 */
export function getAlbumInfo(albumId: any) {
  return Request.axiosInstance({
    url: '/album/info',
    method: 'get',
    params: { albumId }
  })
}

/**
 * 获取相册列表
 * @returns
 */
export function albumList() {
  return Request.axiosInstance({
    url: '/album/list',
    method: 'get'
  })
}
